﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

public class GameRoot : NetworkBehaviour
{
    float timer = 0;
    #region 单例
    public static GameRoot instance;

    Transform castle;
    public void Awake()
    {
        instance = this;
    }
    #endregion

    private void Start()
    {
        LobbyUI.instance.AllUIFalse();
        PanelMgr.Instance.OpenPanel<GamePanel>("Prefabs/UI/GamePanel");
    }
    void Update()
    {
        //if (!isServer)
        //{
        //    return;
        //}
        //else
        //{
        //    if (GameJudge.instance.Player2 != null)
        //    {
        //        castle = GameJudge.instance.Player2.transform.GetChild(1);
        //        if (timer >= 1)
        //        {
        //            //EventManager.Instance.Raise<AddCoinEvent>(new AddCoinEvent(5));
        //            castle.GetComponent<Castle>().BeAttacked(30);
        //            timer = 0;
        //        }
        //        if (castle.GetComponent<Castle>().lives <= 0)
        //        {
        //            castle = GameJudge.instance.Player2.transform.GetChild(2);
        //        }
        //        timer += Time.deltaTime;
        //    }
        //}
    }
}
